<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Emulatrix</title>
		<link rel="stylesheet" href="Emulatrix.css">
	</head>
	<body>
		<script>
			var container_width;
			var container_height;

			var download_running = false;
			var download_Checker;
			var download_Filename;
			var download_LastSize = -1;
			var download_LastSizeRepeated = 0;

			var upload_running = false;
			var upload_Checker;
			var upload_OrigSize = -1;
			var upload_OrigSizeRepeated = 0;

			var loading_Checker;

			var settings_file = "";
			var settings_Checker;

			function loadRomIntoVD()
				{
				// CREATING THE ROM FILE IN THE VIRTUAL DRIVE
				var dataView=new Uint8Array(parent.ROMDATA);
				FS.createDataFile("/",parent.ROMNAME,dataView,true,false);

				// CREATING THE FOLDERS IN THE VIRTUAL DRIVE IN ORDER TO SAVE THE CONFIG FILE
				FS.createFolder("/home/web_user", "retroarch", true, true);
				FS.createFolder("/home/web_user/retroarch", "userdata", true, true);

				// SETTING THE VARIABLE FOR EMPTY VALUE IN THE CONFIG FILE. USING RETROARCH WEB IN MAC HAS A BUG THAT
				// ANY NULL KEY IS FIRED AS THE COMMAND KEY. THAT'S WHY IS SCROLL_BACK INSTEAD OF NUL. THERE IS
				// ANOTHER BUG IN MAC WITH THE COMMAND KEY, THAT IS FIRED AS THE TURBO BUTTON, NO MATTER THE CONFIG.
				var emptyValue = "scroll_lock";

				// SETTING THE DEFAULT FOLDER WHEN BROWSING THE VIRTUAL DRIVE
				settings_file += "rgui_browser_directory = /\n";

				if (parent.ROMNAME=="simpsons4pa.zip")
					{
					// PERSONAL CONFIGURATION FOR THE SIMPSONS THE ARCADE GAME IN ORDER TO USE BART AS PLAYER 1 =)
					settings_file+="input_player3_start = enter\n";settings_file+="input_player3_select = num1\n";settings_file+="input_player3_up = up\n";settings_file+="input_player3_down = down\n";settings_file+="input_player3_left = left\n";settings_file+="input_player3_right = right\n";settings_file+="input_player3_a = s\n";settings_file+="input_player3_b = a\n";settings_file+="input_player3_r = d\n";settings_file+="input_player3_x = w\n";settings_file+="input_player3_y = q\n";settings_file+="input_player3_l = e\n";settings_file+="input_toggle_fast_forward = "+emptyValue+"\n";settings_file+="input_hold_fast_forward = "+emptyValue+"\n";settings_file+="input_toggle_slowmotion = "+emptyValue+"\n";settings_file+="input_hold_slowmotion = "+emptyValue+"\n";settings_file+="input_save_state = "+emptyValue+"\n";settings_file+="input_load_state = "+emptyValue+"\n";settings_file+="input_toggle_fullscreen = "+emptyValue+"\n";settings_file+="input_exit_emulator = "+emptyValue+"\n";settings_file+="input_state_slot_increase = "+emptyValue+"\n";settings_file+="input_state_slot_decrease = "+emptyValue+"\n";settings_file+="input_rewind = "+emptyValue+"\n";settings_file+="input_movie_record_toggle = "+emptyValue+"\n";settings_file+="input_pause_toggle = "+emptyValue+"\n";settings_file+="input_frame_advance = "+emptyValue+"\n";settings_file+="input_reset = f10\n";settings_file+="input_shader_next = "+emptyValue+"\n";settings_file+="input_shader_prev = "+emptyValue+"\n";settings_file+="input_cheat_index_plus = "+emptyValue+"\n";settings_file+="input_cheat_index_minus = "+emptyValue+"\n";settings_file+="input_cheat_toggle = "+emptyValue+"\n";settings_file+="input_screenshot = "+emptyValue+"\n";settings_file+="input_audio_mute = f9\n";settings_file+="input_osk_toggle = "+emptyValue+"\n";settings_file+="input_netplay_game_watch = "+emptyValue+"\n";settings_file+="input_volume_up = "+emptyValue+"\n";settings_file+="input_volume_down = "+emptyValue+"\n";settings_file+="input_overlay_next = "+emptyValue+"\n";settings_file+="input_disk_eject_toggle = "+emptyValue+"\n";settings_file+="input_disk_next = "+emptyValue+"\n";settings_file+="input_disk_prev = "+emptyValue+"\n";settings_file+="input_grab_mouse_toggle = "+emptyValue+"\n";settings_file+="input_game_focus_toggle = "+emptyValue+"\n";settings_file+="input_menu_toggle = "+emptyValue+"\n";settings_file+="input_recording_toggle = "+emptyValue+"\n";settings_file+="input_streaming_toggle = "+emptyValue+"\n";settings_file+="input_player1_up = "+emptyValue+"\n";settings_file+="input_player1_down = "+emptyValue+"\n";settings_file+="input_player1_left = "+emptyValue+"\n";settings_file+="input_player1_right = "+emptyValue+"\n";settings_file+="input_player1_start = "+emptyValue+"\n";settings_file+="input_player1_select = "+emptyValue+"\n";settings_file+="input_player1_a = "+emptyValue+"\n";settings_file+="input_player1_b = "+emptyValue+"\n";settings_file+="input_player1_x = "+emptyValue+"\n";settings_file+="input_player1_y = "+emptyValue+"\n";settings_file+="input_player1_l = "+emptyValue+"\n";settings_file+="input_player1_l2 = "+emptyValue+"\n";settings_file+="input_player1_l3 = "+emptyValue+"\n";settings_file+="input_player1_r = "+emptyValue+"\n";settings_file+="input_player1_r2 = "+emptyValue+"\n";settings_file+="input_player1_r3 = "+emptyValue+"\n";settings_file+="input_player1_l_x_plus = "+emptyValue+"\n";settings_file+="input_player1_l_x_minus = "+emptyValue+"\n";settings_file+="input_player1_l_y_plus = "+emptyValue+"\n";settings_file+="input_player1_l_y_minus = "+emptyValue+"\n";settings_file+="input_player1_r_x_plus = "+emptyValue+"\n";settings_file+="input_player1_r_x_minus = "+emptyValue+"\n";settings_file+="input_player1_r_y_plus = "+emptyValue+"\n";settings_file+="input_player1_r_y_minus = "+emptyValue+"\n";settings_file+="input_player1_gun_trigger = "+emptyValue+"\n";settings_file+="input_player1_gun_offscreen_shot = "+emptyValue+"\n";settings_file+="input_player1_gun_aux_a = "+emptyValue+"\n";settings_file+="input_player1_gun_aux_b = "+emptyValue+"\n";settings_file+="input_player1_gun_aux_c = "+emptyValue+"\n";settings_file+="input_player1_gun_start = "+emptyValue+"\n";settings_file+="input_player1_gun_select = "+emptyValue+"\n";settings_file+="input_player1_gun_dpad_up = "+emptyValue+"\n";settings_file+="input_player1_gun_dpad_down = "+emptyValue+"\n";settings_file+="input_player1_gun_dpad_left = "+emptyValue+"\n";settings_file+="input_player1_gun_dpad_right = "+emptyValue+"\n";settings_file+="input_player1_turbo = "+emptyValue+"\n";settings_file+="input_player2_up = "+emptyValue+"\n";settings_file+="input_player2_down = "+emptyValue+"\n";settings_file+="input_player2_left = "+emptyValue+"\n";settings_file+="input_player2_right = "+emptyValue+"\n";settings_file+="input_player2_start = "+emptyValue+"\n";settings_file+="input_player2_select = "+emptyValue+"\n";settings_file+="input_player2_a = "+emptyValue+"\n";settings_file+="input_player2_b = "+emptyValue+"\n";settings_file+="input_player2_x = "+emptyValue+"\n";settings_file+="input_player2_y = "+emptyValue+"\n";settings_file+="input_player2_l = "+emptyValue+"\n";settings_file+="input_player2_l2 = "+emptyValue+"\n";settings_file+="input_player2_l3 = "+emptyValue+"\n";settings_file+="input_player2_r = "+emptyValue+"\n";settings_file+="input_player2_r2 = "+emptyValue+"\n";settings_file+="input_player2_r3 = "+emptyValue+"\n";settings_file+="input_player2_l_x_plus = "+emptyValue+"\n";settings_file+="input_player2_l_x_minus = "+emptyValue+"\n";settings_file+="input_player2_l_y_plus = "+emptyValue+"\n";settings_file+="input_player2_l_y_minus = "+emptyValue+"\n";settings_file+="input_player2_r_x_plus = "+emptyValue+"\n";settings_file+="input_player2_r_x_minus = "+emptyValue+"\n";settings_file+="input_player2_r_y_plus = "+emptyValue+"\n";settings_file+="input_player2_r_y_minus = "+emptyValue+"\n";settings_file+="input_player2_gun_trigger = "+emptyValue+"\n";settings_file+="input_player2_gun_offscreen_shot = "+emptyValue+"\n";settings_file+="input_player2_gun_aux_a = "+emptyValue+"\n";settings_file+="input_player2_gun_aux_b = "+emptyValue+"\n";settings_file+="input_player2_gun_aux_c = "+emptyValue+"\n";settings_file+="input_player2_gun_start = "+emptyValue+"\n";settings_file+="input_player2_gun_select = "+emptyValue+"\n";settings_file+="input_player2_gun_dpad_up = "+emptyValue+"\n";settings_file+="input_player2_gun_dpad_down = "+emptyValue+"\n";settings_file+="input_player2_gun_dpad_left = "+emptyValue+"\n";settings_file+="input_player2_gun_dpad_right = "+emptyValue+"\n";settings_file+="input_player2_turbo = "+emptyValue+"\n";settings_file+="input_player3_l2 = "+emptyValue+"\n";settings_file+="input_player3_r2 = "+emptyValue+"\n";settings_file+="input_player3_l3 = "+emptyValue+"\n";settings_file+="input_player3_r3 = "+emptyValue+"\n";settings_file+="input_player3_l_x_plus = "+emptyValue+"\n";settings_file+="input_player3_l_x_minus = "+emptyValue+"\n";settings_file+="input_player3_l_y_plus = "+emptyValue+"\n";settings_file+="input_player3_l_y_minus = "+emptyValue+"\n";settings_file+="input_player3_r_x_plus = "+emptyValue+"\n";settings_file+="input_player3_r_x_minus = "+emptyValue+"\n";settings_file+="input_player3_r_y_plus = "+emptyValue+"\n";settings_file+="input_player3_r_y_minus = "+emptyValue+"\n";settings_file+="input_player3_gun_trigger = "+emptyValue+"\n";settings_file+="input_player3_gun_offscreen_shot = "+emptyValue+"\n";settings_file+="input_player3_gun_aux_a = "+emptyValue+"\n";settings_file+="input_player3_gun_aux_b = "+emptyValue+"\n";settings_file+="input_player3_gun_aux_c = "+emptyValue+"\n";settings_file+="input_player3_gun_start = "+emptyValue+"\n";settings_file+="input_player3_gun_select = "+emptyValue+"\n";settings_file+="input_player3_gun_dpad_up = "+emptyValue+"\n";settings_file+="input_player3_gun_dpad_down = "+emptyValue+"\n";settings_file+="input_player3_gun_dpad_left = "+emptyValue+"\n";settings_file+="input_player3_gun_dpad_right = "+emptyValue+"\n";settings_file+="input_player3_turbo = "+emptyValue+"\n";settings_file+="input_player4_up = "+emptyValue+"\n";settings_file+="input_player4_down = "+emptyValue+"\n";settings_file+="input_player4_left = "+emptyValue+"\n";settings_file+="input_player4_right = "+emptyValue+"\n";settings_file+="input_player4_start = "+emptyValue+"\n";settings_file+="input_player4_select = "+emptyValue+"\n";settings_file+="input_player4_a = "+emptyValue+"\n";settings_file+="input_player4_b = "+emptyValue+"\n";settings_file+="input_player4_x = "+emptyValue+"\n";settings_file+="input_player4_y = "+emptyValue+"\n";settings_file+="input_player4_l = "+emptyValue+"\n";settings_file+="input_player4_l2 = "+emptyValue+"\n";settings_file+="input_player4_l3 = "+emptyValue+"\n";settings_file+="input_player4_r = "+emptyValue+"\n";settings_file+="input_player4_r2 = "+emptyValue+"\n";settings_file+="input_player4_r3 = "+emptyValue+"\n";settings_file+="input_player4_l_x_plus = "+emptyValue+"\n";settings_file+="input_player4_l_x_minus = "+emptyValue+"\n";settings_file+="input_player4_l_y_plus = "+emptyValue+"\n";settings_file+="input_player4_l_y_minus = "+emptyValue+"\n";settings_file+="input_player4_r_x_plus = "+emptyValue+"\n";settings_file+="input_player4_r_x_minus = "+emptyValue+"\n";settings_file+="input_player4_r_y_plus = "+emptyValue+"\n";settings_file+="input_player4_r_y_minus = "+emptyValue+"\n";settings_file+="input_player4_gun_trigger = "+emptyValue+"\n";settings_file+="input_player4_gun_offscreen_shot = "+emptyValue+"\n";settings_file+="input_player4_gun_aux_a = "+emptyValue+"\n";settings_file+="input_player4_gun_aux_b = "+emptyValue+"\n";settings_file+="input_player4_gun_aux_c = "+emptyValue+"\n";settings_file+="input_player4_gun_start = "+emptyValue+"\n";settings_file+="input_player4_gun_select = "+emptyValue+"\n";settings_file+="input_player4_gun_dpad_up = "+emptyValue+"\n";settings_file+="input_player4_gun_dpad_down = "+emptyValue+"\n";settings_file+="input_player4_gun_dpad_left = "+emptyValue+"\n";settings_file+="input_player4_gun_dpad_right = "+emptyValue+"\n";settings_file+="input_player4_turbo = "+emptyValue+"\n";settings_file+="input_player5_up = "+emptyValue+"\n";settings_file+="input_player5_down = "+emptyValue+"\n";settings_file+="input_player5_left = "+emptyValue+"\n";settings_file+="input_player5_right = "+emptyValue+"\n";settings_file+="input_player5_start = "+emptyValue+"\n";settings_file+="input_player5_select = "+emptyValue+"\n";settings_file+="input_player5_a = "+emptyValue+"\n";settings_file+="input_player5_b = "+emptyValue+"\n";settings_file+="input_player5_x = "+emptyValue+"\n";settings_file+="input_player5_y = "+emptyValue+"\n";settings_file+="input_player5_l = "+emptyValue+"\n";settings_file+="input_player5_l2 = "+emptyValue+"\n";settings_file+="input_player5_l3 = "+emptyValue+"\n";settings_file+="input_player5_r = "+emptyValue+"\n";settings_file+="input_player5_r2 = "+emptyValue+"\n";settings_file+="input_player5_r3 = "+emptyValue+"\n";settings_file+="input_player5_l_x_plus = "+emptyValue+"\n";settings_file+="input_player5_l_x_minus = "+emptyValue+"\n";settings_file+="input_player5_l_y_plus = "+emptyValue+"\n";settings_file+="input_player5_l_y_minus = "+emptyValue+"\n";settings_file+="input_player5_r_x_plus = "+emptyValue+"\n";settings_file+="input_player5_r_x_minus = "+emptyValue+"\n";settings_file+="input_player5_r_y_plus = "+emptyValue+"\n";settings_file+="input_player5_r_y_minus = "+emptyValue+"\n";settings_file+="input_player5_gun_trigger = "+emptyValue+"\n";settings_file+="input_player5_gun_offscreen_shot = "+emptyValue+"\n";settings_file+="input_player5_gun_aux_a = "+emptyValue+"\n";settings_file+="input_player5_gun_aux_b = "+emptyValue+"\n";settings_file+="input_player5_gun_aux_c = "+emptyValue+"\n";settings_file+="input_player5_gun_start = "+emptyValue+"\n";settings_file+="input_player5_gun_select = "+emptyValue+"\n";settings_file+="input_player5_gun_dpad_up = "+emptyValue+"\n";settings_file+="input_player5_gun_dpad_down = "+emptyValue+"\n";settings_file+="input_player5_gun_dpad_left = "+emptyValue+"\n";settings_file+="input_player5_gun_dpad_right = "+emptyValue+"\n";settings_file+="input_player5_turbo = "+emptyValue+"\n";
					}
					else
					{
					// SETTING THE KEY FOR THE START AND INSERT COIN BUTTON
					settings_file += "input_player1_start = enter\n";
					settings_file += "input_player1_select = num1\n";

					// SETTING THE KEY FOR THE PLAYER 1
					settings_file += "input_player1_a = s\n";
					settings_file += "input_player1_b = a\n";
					settings_file += "input_player1_r = d\n";
					settings_file += "input_player1_x = w\n";
					settings_file += "input_player1_y = q\n";
					settings_file += "input_player1_l = e\n";

					// SETTING THE KEY FOR SOUND TOGGLE
					settings_file += "input_audio_mute = f9\n";

					// SETTING THE KEY FOR RELOADING THE GAME
					settings_file += "input_reset = f10\n";

					// SETTING THE KEYS FOR UNWANTED FUNCTIONS
					settings_file += "input_toggle_fast_forward = " + emptyValue + "\n";
					settings_file += "input_hold_fast_forward = " + emptyValue + "\n";
					settings_file += "input_toggle_slowmotion = " + emptyValue + "\n";
					settings_file += "input_hold_slowmotion = " + emptyValue + "\n";
					settings_file += "input_save_state = " + emptyValue + "\n";
					settings_file += "input_load_state = " + emptyValue + "\n";
					settings_file += "input_toggle_fullscreen = " + emptyValue + "\n";
					settings_file += "input_exit_emulator = " + emptyValue + "\n";
					settings_file += "input_state_slot_increase = " + emptyValue + "\n";
					settings_file += "input_state_slot_decrease = " + emptyValue + "\n";
					settings_file += "input_rewind = " + emptyValue + "\n";
					settings_file += "input_movie_record_toggle = " + emptyValue + "\n";
					settings_file += "input_pause_toggle = " + emptyValue + "\n";
					settings_file += "input_frame_advance = " + emptyValue + "\n";
					settings_file += "input_shader_next = " + emptyValue + "\n";
					settings_file += "input_shader_prev = " + emptyValue + "\n";
					settings_file += "input_cheat_index_plus = " + emptyValue + "\n";
					settings_file += "input_cheat_index_minus = " + emptyValue + "\n";
					settings_file += "input_cheat_toggle = " + emptyValue + "\n";
					settings_file += "input_screenshot = " + emptyValue + "\n";
					settings_file += "input_osk_toggle = " + emptyValue + "\n";
					settings_file += "input_netplay_game_watch = " + emptyValue + "\n";
					//settings_file += "input_enable_hotkey = " + emptyValue + "\n";
					settings_file += "input_volume_up = " + emptyValue + "\n";
					settings_file += "input_volume_down = " + emptyValue + "\n";
					settings_file += "input_overlay_next = " + emptyValue + "\n";
					settings_file += "input_disk_eject_toggle = " + emptyValue + "\n";
					settings_file += "input_disk_next = " + emptyValue + "\n";
					settings_file += "input_disk_prev = " + emptyValue + "\n";
					settings_file += "input_grab_mouse_toggle = " + emptyValue + "\n";
					settings_file += "input_game_focus_toggle = " + emptyValue + "\n";
					settings_file += "input_menu_toggle = " + emptyValue + "\n";
					settings_file += "input_recording_toggle = " + emptyValue + "\n";
					settings_file += "input_streaming_toggle = " + emptyValue + "\n";

					// PLAYER 1
					settings_file += "input_player1_l2 = " + emptyValue + "\n";
					settings_file += "input_player1_r2 = " + emptyValue + "\n";
					settings_file += "input_player1_l3 = " + emptyValue + "\n";
					settings_file += "input_player1_r3 = " + emptyValue + "\n";
					settings_file += "input_player1_l_x_plus = " + emptyValue + "\n";
					settings_file += "input_player1_l_x_minus = " + emptyValue + "\n";
					settings_file += "input_player1_l_y_plus = " + emptyValue + "\n";
					settings_file += "input_player1_l_y_minus = " + emptyValue + "\n";
					settings_file += "input_player1_r_x_plus = " + emptyValue + "\n";
					settings_file += "input_player1_r_x_minus = " + emptyValue + "\n";
					settings_file += "input_player1_r_y_plus = " + emptyValue + "\n";
					settings_file += "input_player1_r_y_minus = " + emptyValue + "\n";
					settings_file += "input_player1_gun_trigger = " + emptyValue + "\n";
					settings_file += "input_player1_gun_offscreen_shot = " + emptyValue + "\n";
					settings_file += "input_player1_gun_aux_a = " + emptyValue + "\n";
					settings_file += "input_player1_gun_aux_b = " + emptyValue + "\n";
					settings_file += "input_player1_gun_aux_c = " + emptyValue + "\n";
					settings_file += "input_player1_gun_start = " + emptyValue + "\n";
					settings_file += "input_player1_gun_select = " + emptyValue + "\n";
					settings_file += "input_player1_gun_dpad_up = " + emptyValue + "\n";
					settings_file += "input_player1_gun_dpad_down = " + emptyValue + "\n";
					settings_file += "input_player1_gun_dpad_left = " + emptyValue + "\n";
					settings_file += "input_player1_gun_dpad_right = " + emptyValue + "\n";
					settings_file += "input_player1_turbo = " + emptyValue + "\n";

					// PLAYER 2
					settings_file += "input_player2_up = " + emptyValue + "\n";
					settings_file += "input_player2_down = " + emptyValue + "\n";
					settings_file += "input_player2_left = " + emptyValue + "\n";
					settings_file += "input_player2_right = " + emptyValue + "\n";
					settings_file += "input_player2_start = " + emptyValue + "\n";
					settings_file += "input_player2_select = " + emptyValue + "\n";
					settings_file += "input_player2_a = " + emptyValue + "\n";
					settings_file += "input_player2_b = " + emptyValue + "\n";
					settings_file += "input_player2_x = " + emptyValue + "\n";
					settings_file += "input_player2_y = " + emptyValue + "\n";
					settings_file += "input_player2_l = " + emptyValue + "\n";
					settings_file += "input_player2_l2 = " + emptyValue + "\n";
					settings_file += "input_player2_l3 = " + emptyValue + "\n";
					settings_file += "input_player2_r = " + emptyValue + "\n";
					settings_file += "input_player2_r2 = " + emptyValue + "\n";
					settings_file += "input_player2_r3 = " + emptyValue + "\n";
					settings_file += "input_player2_l_x_plus = " + emptyValue + "\n";
					settings_file += "input_player2_l_x_minus = " + emptyValue + "\n";
					settings_file += "input_player2_l_y_plus = " + emptyValue + "\n";
					settings_file += "input_player2_l_y_minus = " + emptyValue + "\n";
					settings_file += "input_player2_r_x_plus = " + emptyValue + "\n";
					settings_file += "input_player2_r_x_minus = " + emptyValue + "\n";
					settings_file += "input_player2_r_y_plus = " + emptyValue + "\n";
					settings_file += "input_player2_r_y_minus = " + emptyValue + "\n";
					settings_file += "input_player2_gun_trigger = " + emptyValue + "\n";
					settings_file += "input_player2_gun_offscreen_shot = " + emptyValue + "\n";
					settings_file += "input_player2_gun_aux_a = " + emptyValue + "\n";
					settings_file += "input_player2_gun_aux_b = " + emptyValue + "\n";
					settings_file += "input_player2_gun_aux_c = " + emptyValue + "\n";
					settings_file += "input_player2_gun_start = " + emptyValue + "\n";
					settings_file += "input_player2_gun_select = " + emptyValue + "\n";
					settings_file += "input_player2_gun_dpad_up = " + emptyValue + "\n";
					settings_file += "input_player2_gun_dpad_down = " + emptyValue + "\n";
					settings_file += "input_player2_gun_dpad_left = " + emptyValue + "\n";
					settings_file += "input_player2_gun_dpad_right = " + emptyValue + "\n";
					settings_file += "input_player2_turbo = " + emptyValue + "\n";

					// PLAYER 3
					settings_file += "input_player3_up = " + emptyValue + "\n";
					settings_file += "input_player3_down = " + emptyValue + "\n";
					settings_file += "input_player3_left = " + emptyValue + "\n";
					settings_file += "input_player3_right = " + emptyValue + "\n";
					settings_file += "input_player3_start = " + emptyValue + "\n";
					settings_file += "input_player3_select = " + emptyValue + "\n";
					settings_file += "input_player3_a = " + emptyValue + "\n";
					settings_file += "input_player3_b = " + emptyValue + "\n";
					settings_file += "input_player3_x = " + emptyValue + "\n";
					settings_file += "input_player3_y = " + emptyValue + "\n";
					settings_file += "input_player3_l = " + emptyValue + "\n";
					settings_file += "input_player3_l2 = " + emptyValue + "\n";
					settings_file += "input_player3_l3 = " + emptyValue + "\n";
					settings_file += "input_player3_r = " + emptyValue + "\n";
					settings_file += "input_player3_r2 = " + emptyValue + "\n";
					settings_file += "input_player3_r3 = " + emptyValue + "\n";
					settings_file += "input_player3_l_x_plus = " + emptyValue + "\n";
					settings_file += "input_player3_l_x_minus = " + emptyValue + "\n";
					settings_file += "input_player3_l_y_plus = " + emptyValue + "\n";
					settings_file += "input_player3_l_y_minus = " + emptyValue + "\n";
					settings_file += "input_player3_r_x_plus = " + emptyValue + "\n";
					settings_file += "input_player3_r_x_minus = " + emptyValue + "\n";
					settings_file += "input_player3_r_y_plus = " + emptyValue + "\n";
					settings_file += "input_player3_r_y_minus = " + emptyValue + "\n";
					settings_file += "input_player3_gun_trigger = " + emptyValue + "\n";
					settings_file += "input_player3_gun_offscreen_shot = " + emptyValue + "\n";
					settings_file += "input_player3_gun_aux_a = " + emptyValue + "\n";
					settings_file += "input_player3_gun_aux_b = " + emptyValue + "\n";
					settings_file += "input_player3_gun_aux_c = " + emptyValue + "\n";
					settings_file += "input_player3_gun_start = " + emptyValue + "\n";
					settings_file += "input_player3_gun_select = " + emptyValue + "\n";
					settings_file += "input_player3_gun_dpad_up = " + emptyValue + "\n";
					settings_file += "input_player3_gun_dpad_down = " + emptyValue + "\n";
					settings_file += "input_player3_gun_dpad_left = " + emptyValue + "\n";
					settings_file += "input_player3_gun_dpad_right = " + emptyValue + "\n";
					settings_file += "input_player3_turbo = " + emptyValue + "\n";

					// PLAYER 4
					settings_file += "input_player4_up = " + emptyValue + "\n";
					settings_file += "input_player4_down = " + emptyValue + "\n";
					settings_file += "input_player4_left = " + emptyValue + "\n";
					settings_file += "input_player4_right = " + emptyValue + "\n";
					settings_file += "input_player4_start = " + emptyValue + "\n";
					settings_file += "input_player4_select = " + emptyValue + "\n";
					settings_file += "input_player4_a = " + emptyValue + "\n";
					settings_file += "input_player4_b = " + emptyValue + "\n";
					settings_file += "input_player4_x = " + emptyValue + "\n";
					settings_file += "input_player4_y = " + emptyValue + "\n";
					settings_file += "input_player4_l = " + emptyValue + "\n";
					settings_file += "input_player4_l2 = " + emptyValue + "\n";
					settings_file += "input_player4_l3 = " + emptyValue + "\n";
					settings_file += "input_player4_r = " + emptyValue + "\n";
					settings_file += "input_player4_r2 = " + emptyValue + "\n";
					settings_file += "input_player4_r3 = " + emptyValue + "\n";
					settings_file += "input_player4_l_x_plus = " + emptyValue + "\n";
					settings_file += "input_player4_l_x_minus = " + emptyValue + "\n";
					settings_file += "input_player4_l_y_plus = " + emptyValue + "\n";
					settings_file += "input_player4_l_y_minus = " + emptyValue + "\n";
					settings_file += "input_player4_r_x_plus = " + emptyValue + "\n";
					settings_file += "input_player4_r_x_minus = " + emptyValue + "\n";
					settings_file += "input_player4_r_y_plus = " + emptyValue + "\n";
					settings_file += "input_player4_r_y_minus = " + emptyValue + "\n";
					settings_file += "input_player4_gun_trigger = " + emptyValue + "\n";
					settings_file += "input_player4_gun_offscreen_shot = " + emptyValue + "\n";
					settings_file += "input_player4_gun_aux_a = " + emptyValue + "\n";
					settings_file += "input_player4_gun_aux_b = " + emptyValue + "\n";
					settings_file += "input_player4_gun_aux_c = " + emptyValue + "\n";
					settings_file += "input_player4_gun_start = " + emptyValue + "\n";
					settings_file += "input_player4_gun_select = " + emptyValue + "\n";
					settings_file += "input_player4_gun_dpad_up = " + emptyValue + "\n";
					settings_file += "input_player4_gun_dpad_down = " + emptyValue + "\n";
					settings_file += "input_player4_gun_dpad_left = " + emptyValue + "\n";
					settings_file += "input_player4_gun_dpad_right = " + emptyValue + "\n";
					settings_file += "input_player4_turbo = " + emptyValue + "\n";

					// PLAYER 5
					settings_file += "input_player5_up = " + emptyValue + "\n";
					settings_file += "input_player5_down = " + emptyValue + "\n";
					settings_file += "input_player5_left = " + emptyValue + "\n";
					settings_file += "input_player5_right = " + emptyValue + "\n";
					settings_file += "input_player5_start = " + emptyValue + "\n";
					settings_file += "input_player5_select = " + emptyValue + "\n";
					settings_file += "input_player5_a = " + emptyValue + "\n";
					settings_file += "input_player5_b = " + emptyValue + "\n";
					settings_file += "input_player5_x = " + emptyValue + "\n";
					settings_file += "input_player5_y = " + emptyValue + "\n";
					settings_file += "input_player5_l = " + emptyValue + "\n";
					settings_file += "input_player5_l2 = " + emptyValue + "\n";
					settings_file += "input_player5_l3 = " + emptyValue + "\n";
					settings_file += "input_player5_r = " + emptyValue + "\n";
					settings_file += "input_player5_r2 = " + emptyValue + "\n";
					settings_file += "input_player5_r3 = " + emptyValue + "\n";
					settings_file += "input_player5_l_x_plus = " + emptyValue + "\n";
					settings_file += "input_player5_l_x_minus = " + emptyValue + "\n";
					settings_file += "input_player5_l_y_plus = " + emptyValue + "\n";
					settings_file += "input_player5_l_y_minus = " + emptyValue + "\n";
					settings_file += "input_player5_r_x_plus = " + emptyValue + "\n";
					settings_file += "input_player5_r_x_minus = " + emptyValue + "\n";
					settings_file += "input_player5_r_y_plus = " + emptyValue + "\n";
					settings_file += "input_player5_r_y_minus = " + emptyValue + "\n";
					settings_file += "input_player5_gun_trigger = " + emptyValue + "\n";
					settings_file += "input_player5_gun_offscreen_shot = " + emptyValue + "\n";
					settings_file += "input_player5_gun_aux_a = " + emptyValue + "\n";
					settings_file += "input_player5_gun_aux_b = " + emptyValue + "\n";
					settings_file += "input_player5_gun_aux_c = " + emptyValue + "\n";
					settings_file += "input_player5_gun_start = " + emptyValue + "\n";
					settings_file += "input_player5_gun_select = " + emptyValue + "\n";
					settings_file += "input_player5_gun_dpad_up = " + emptyValue + "\n";
					settings_file += "input_player5_gun_dpad_down = " + emptyValue + "\n";
					settings_file += "input_player5_gun_dpad_left = " + emptyValue + "\n";
					settings_file += "input_player5_gun_dpad_right = " + emptyValue + "\n";
					settings_file += "input_player5_turbo = " + emptyValue + "\n";
					}

				// SETTING THE VIDEO CONFIGURATION
				container_width = document.getElementById("container").offsetWidth;
				container_height = document.getElementById("container").offsetHeight;
				settings_file += "video_vsync = true\n";
				settings_file += "video_scale = 1\n";
				settings_file += "video_window_x = " + container_width + "\n";
				settings_file += "video_window_y = " + container_height + "\n";
				settings_file += "aspect_ratio_index = 23\n";
				settings_file += "custom_viewport_width = " + container_width + "\n";
				settings_file += "custom_viewport_height = " + container_height + "\n";
				settings_file += "custom_viewport_x = 0\n";
				settings_file += "custom_viewport_y = 0\n";

				// SETTING THE AUDIO LATENCY
				settings_file += "audio_latency = 128\n";

				// HIDING THE NOTIFICATION MESSAGES
				settings_file += "video_message_pos_x = -100\n";
				settings_file += "video_message_pos_y = -100\n";
				settings_file += "menu_enable_widgets = false\n";

				// CREATING THE FILE WITH THE CONFIGURATION
				FS.createDataFile("/home/web_user/retroarch/userdata", "retroarch.cfg", settings_file, true, true);

				// WAITING A PRUDENTIAL TIME FOR THE RETROARCH.CFG FILE TO BE CREATED
				settings_Checker = setInterval(checkSettingsFile, 1000);
				}

			function checkSettingsFile()
				{
				// SETTING THE VARIABLE TO KNOW IF THE EMULATOR MUST START
				var mustStart = false;

				try
					{
					// TRYING TO READ THE SETTINGS FILE
					var myTempFile = FS.readFile("/home/web_user/retroarch/userdata/retroarch.cfg");

					// CHECKING IF THE SETTINGS FILE HAS DATA
					if (myTempFile.length==settings_file.length)
						{
						mustStart = true;
						}
					}
					catch(err)
					{
					}

				// CHECKING IF THE EMULATOR MUST START
				if (mustStart==true)
					{
					// DISABLING THE SETTINGS FILE CHECKER
					clearInterval(settings_Checker);

					// STARTING THE EMULATOR
					setTimeout(function()
						{
						startEmulator();
						},1500);
					}
				}

			function startEmulator()
				{
				// RUNNING THE EMULATOR WITH THE SELECTED ROM
				Module.callMain(["-v","/" + parent.ROMNAME]);

				// RESIZING THE CANVAS
				document.getElementById("canvas").width = container_width;
				document.getElementById("canvas").height = container_height;
				setTimeout(function(){resizeEmulatorCanvas()},500);
				setTimeout(function(){resizeEmulatorCanvas()},1000);
				setTimeout(function(){resizeEmulatorCanvas()},1500);
				}

			function resizeEmulatorCanvas()
				{
				try
					{
					container_width = document.getElementById("container").offsetWidth;
					container_height = document.getElementById("container").offsetHeight;
					Module.setCanvasSize(container_width,container_height,true);
					}
					catch(err)
					{
					}
				}

			function toggleSound()
				{
				try
					{
					// RESUMING THE EMULATION
					Emulator_running = true;

					// PRESSING THE F9 KEY
					sendVirtualKey("keydown","F9")

					// RELEASING THE F9 KEY
					setTimeout(function()
						{
						sendVirtualKey("keyup","F9");
						}, 50);
					}
					catch(err)
					{
					}
				}

			function reloadROM()
				{
				try
					{
					// RESUMING THE EMULATION
					Emulator_running = true;

					// PRESSING THE F10 KEY
					sendVirtualKey("keydown","F10")

					// RELEASING THE F10 KEY
					setTimeout(function()
						{
						sendVirtualKey("keyup","F10");
						}, 50);
					}
					catch(err)
					{
					}
				}

			function downloadROMState()
				{
				try
					{
					// RESUMING THE EMULATION
					Emulator_running = true;

					// CHECKING IF THE DOWNLOADING AND UPLOADING PROCESS ARE NOT RUNNING
					if (download_running==false && upload_running==false)
						{
						// SETTING THE DOWNLOADING PROCESS AS TRUE
						download_running = true;

						// SAVING THE STATE (TAKES A LOT OF SECONDS IN SOME CASES, EMSCRIPTED + LIBRETRO RELATED ISSUE)
						Module._cmd_save_state();

						// GETTING THE ROM FILENAME WITHOUT THE EXTENSION
						download_Filename = parent.ROMNAME.replace(/\.[^/.]+$/, "");

						// SETTING THE DEFAULT VALUES FOR THE VARIABLES THAT WILL CHECK THE DOWNLOADING PROCESS
						download_LastSize = -1;
						download_LastSizeRepeated = 0;

						// RESTORING THE ORIGINAL LABEL TEXT
						document.getElementsByClassName("gui_saving")[0].innerHTML = parent.STRING_SAVING;

						// SHOWING THE 'SAVING, PLEASE WAIT...' LABEL
						document.getElementsByClassName("gui_saving")[0].style.display = "block";

						// STARTING THE TASK THAT WILL DOWNLOAD THE ROMSTATE AS A FILE
						download_Checker = setInterval(download_CheckerCron, 1000);
						}
					}
					catch(err)
					{
					}
				}

			function download_CheckerCron()
				{
				try
					{
					// TRYING TO READ THE ROMSTATE FILE
					var myTempFile = FS.readFile("/home/web_user/retroarch/userdata/states/" + download_Filename + ".state");

					// THE ROMSTATE FILE IS GOING TO BE WRITTEN WITH AN ASYNCHRONOUS TASK THAT WE CAN'T HANDLE IN ANY WAY.
					// THIS IS THE REASON WHY WE NEED TO CHECK IF THE FILESIZE IS THE SAME AFTER SEVERAL CHECKINGS.

					// CHECKING THE ROMSTATE FILE SIZE
					if (myTempFile.length==download_LastSize)
						{
						// CHECKING IF THE EMULATOR IS RUNNING
						if (Emulator_running==true)
							{
							// IF IT IS THE SAME, WE ADD 1 TO THE VARIABLE THAT WE USE FOR CHECKING THIS
							download_LastSizeRepeated = download_LastSizeRepeated + 1;
							}
						}
						else
						{
						// IF THE FILE SIZE IS NOT THE SAME, WE UPDATE A VARIABLE WITH THE LAST FILE SIZE THAT WE GOT
						download_LastSize = myTempFile.length;
						}

					// IF THE FILE SIZE IS THE SAME AFTER SEVERAL CHECKINGS
					if (download_LastSizeRepeated>parent.STATE_CHECK_TIMES)
						{
						// SETTING THE DEFAULT VALUES FOR THE VARIABLES THAT WE USED FOR CHECKING
						download_LastSize = -1;
						download_LastSizeRepeated = 0;

						// DELETING THE ROMSTATE FILE FROM THE FS
						FS.unlink("/home/web_user/retroarch/userdata/states/" + download_Filename + ".state");

						// DOWNLOADING THE ROMSTATE AS A FILE
						download_Blob(myTempFile, download_Filename + ".state", "application/octet-stream");

						// UPDATING THE LABEL TEXT IN ORDER TO TELL THE USER THAT A FILE WAS DOWNLOADED
						document.getElementsByClassName("gui_saving")[0].innerHTML = parent.STRING_SAVED;

						// SETTING THE DOWNLOAD PROCESS AS FALSE
						download_running = false;

						setTimeout(function()
							{
							// CHECKING IF THE LABEL MUST BE HIDDEN
							if (download_running==false)
								{
								// HIDING THE LABEL
								document.getElementsByClassName("gui_saving")[0].style.display = "none";

								// RESTORING THE ORIGINAL LABEL TEXT
								document.getElementsByClassName("gui_saving")[0].innerHTML = parent.STRING_SAVING;
								}
							}, 3000);

						// DISABLING THE DOWNLOADING TASK
						clearInterval(download_Checker);
						}
					}
					catch(err)
					{
					}
				}

			function download_Blob(data, fileName, mimeType)
				{
				var blob, url;
				blob = new Blob([data], {type: mimeType});
				url = window.URL.createObjectURL(blob);
				download_URL(url, fileName);
				}

			function download_URL(data, fileName)
				{
				var a;
				a = document.createElement("a");
				a.href = data;
				a.download = fileName;
				document.body.appendChild(a);
				a.style = "display: none";
				a.click();
				a.remove();
				}

			function uploadROMState()
				{
				try
					{
					// RESUMING THE EMULATION
					Emulator_running = true;

					// CHECKING IF THE UPLOADING AND DOWNLOADING PROCESS ARE NOT RUNNING
					if (upload_running==false && download_running==false)
						{
						// HIDING THE 'SAVING, PLEASE WAIT...' LABEL
						document.getElementsByClassName("gui_saving")[0].style.display = "none";

						// ALLOWING THE USER TO SELECT THE ROMSTATE FILE FROM THE COMPUTER OR MOBILE DEVICE
						document.getElementById("fileupload_uploader").click();
						}
					}
					catch(err)
					{
					}
				}

			function upload_getFile(files)
				{
				try
					{
					// CHECKING THE FILE EXTENSION
					var extension = files[0].name.split(".").pop().toLowerCase();
					if (extension=="state")
						{
						// SETTING THE UPLOADING PROCESS AS TRUE
						upload_running = true;

						// READING THE SELECTED FILE
						var filereader = new FileReader();
						filereader.file_name = files[0].name;
						filereader.onload = function()
							{
							// GETTING THE ROMFILE NAME
							download_Filename = parent.ROMNAME.replace(/\.[^/.]+$/, "");

							// CHECKING IF THERE IS A PREVIOUS ROMSTATE FILE CREATED, IF SO, IT IS DELETED
							try
								{
								var myTempFile = FS.readFile("/home/web_user/retroarch/userdata/states/" + download_Filename + ".state");
								FS.unlink("/home/web_user/retroarch/userdata/states/" + download_Filename + ".state");
								}
								catch(err)
								{
								}

							// CREATING THE ROMSTATE FILE
							var dataView = new Uint8Array(this.result);
							FS.createDataFile("/home/web_user/retroarch/userdata/states",download_Filename+".state",dataView,true,true);

							// SETTING THE DEFAULT VALUES FOR THE VARIABLES THAT WILL CHECK THE UPLOADING PROCESS
							upload_OrigSize = dataView.length;
							upload_OrigSizeRepeated = 0;

							// CLEARING THE SELECTED FILE VALUE
							document.getElementById("fileupload_uploader").value = null;

							// SHOWING THE 'LOADING, PLEASE WAIT...' LABEL
							document.getElementsByClassName("gui_loading")[0].style.display = "block";

							// STARTING THE TASK THAT WILL UPLOAD THE ROMSTATE FILE
							upload_Checker = setInterval(upload_CheckerCron, 1000);
							};
						filereader.readAsArrayBuffer(files[0]);
						}
					}
					catch(err)
					{
					}
				}

			function upload_CheckerCron()
				{
				try
					{
					// TRYING TO READ THE ROMSTATE FILE
					var myTempFile = FS.readFile("/home/web_user/retroarch/userdata/states/" + download_Filename + ".state");

					// THE ROMSTATE FILE IS GOING TO BE WRITTEN WITH AN ASYNCHRONOUS TASK THAT WE CAN'T HANDLE IN ANY WAY.
					// THIS IS THE REASON WHY WE NEED TO CHECK IF THE FILESIZE IS THE SAME AFTER SEVERAL CHECKINGS.

					// CHECKING THE ROMSTATE FILE SIZE
					if (myTempFile.length==upload_OrigSize)
						{
						// IF IT IS THE SAME, WE ADD 1 TO THE VARIABLE THAT WE USE FOR CHECKING THIS
						upload_OrigSizeRepeated = upload_OrigSizeRepeated + 1;
						}

					// IF THE FILE SIZE IS THE SAME AFTER SEVERAL CHECKINGS
					if (upload_OrigSizeRepeated>parent.STATE_CHECK_TIMES)
						{
						// SETTING THE DEFAULT VALUES FOR THE VARIABLES THAT WE USED FOR CHECKING
						upload_OrigSize = -1;
						upload_OrigSizeRepeated = 0;

						// SETTING THE UPLOAD PROCESS AS FALSE
						upload_running = false;

						// LOADING THE STATE (TAKES A LOT OF SECONDS IN SOME CASES, EMSCRIPTED + LIBRETRO RELATED ISSUE)
						Module._cmd_load_state();

						// HIDING THE 'LOADING, PLEASE WAIT...' LABEL
						document.getElementsByClassName("gui_loading")[0].style.display = "none";

						// DISABLING THE UPLOADING TASK
						clearInterval(upload_Checker);
						}
					}
					catch(err)
					{
					}
				}

			function loadingChecker()
				{
				try
					{
					// CHECKING IF THE EMULATOR WAS STARTED
					if (Emulator_started==true)
						{
						// HIDING THE LOADING ICON AND TEXT
						document.getElementsByClassName("gui_pleasewait_title")[0].style.display = "none";
						document.getElementsByClassName("pleasewait")[0].style.display = "none";

						// DISABLING THE LOADING CHECKER
						clearInterval(loading_Checker);
						}
					}
					catch(err)
					{
					}
				}

			window.addEventListener("blur", function()
				{
				try
					{
					// PAUSING THE EMULATION
					Emulator_running = false;
					}
					catch(err)
					{
					}
				});

			window.addEventListener("focus", function()
				{
				try
					{
					// RESUMING THE EMULATION
					Emulator_running = true;
					}
					catch(err)
					{
					}
				});

			window.addEventListener("resize", function()
				{
				// RESIZING CANVAS IF THE WINDOW HAS BEEN RESIZED
				resizeEmulatorCanvas();
				});

			window.addEventListener("load", function()
				{
				// SHOWING THE CANVAS CONTAINER
				document.getElementById("container").style.display="block";

				// STARTING THE FILE SYSTEM
				setTimeout(function(){startFileSystem()},1000);

				// LOADING THE ROM
				setTimeout(function(){loadRomIntoVD()},2000);

				// CHECKING WHEN THE EMULATOR IS RUNNING IN ORDER TO HIDE THE LOADING ICON AND TEXT
				loading_Checker = setInterval(loadingChecker, 500);

				// SETTING FUNCTIONS THAT WILL BE CALLED WHEN THE USER CLICKS, DOUBLE CLICKS OR MOVES THE MOUSE IN ORDER TO SHOW THE SYSTEM ICONS
				document.addEventListener("click", parent.goBackButtonResetIncrement, false);
				document.addEventListener("dblclick", parent.goBackButtonResetIncrement, false);
				document.addEventListener("mousemove", parent.goBackButtonResetIncrement, false);

				// CHECKING IF IT IS A MOBILE DEVICE
				if (isMobileDevice()==true)
					{
					// SHOWING THE VIRTUAL BUTTONS AND ASSIGNING TOUCHING EVENTS TO EACH ONE OF THEM
					document.getElementsByClassName("gui_mame32_keycoin")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keycoin")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","Digit1")});
					document.getElementsByClassName("gui_mame32_keycoin")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","Digit1")});
					document.getElementsByClassName("gui_mame32_keystart")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keystart")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","Enter")});
					document.getElementsByClassName("gui_mame32_keystart")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","Enter")});
					document.getElementsByClassName("gui_mame32_keya")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keya")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","KeyA")});
					document.getElementsByClassName("gui_mame32_keya")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","KeyA")});
					document.getElementsByClassName("gui_mame32_keyb")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keyb")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","KeyS")});
					document.getElementsByClassName("gui_mame32_keyb")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","KeyS")});
					document.getElementsByClassName("gui_mame32_keyc")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keyc")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","KeyD")});
					document.getElementsByClassName("gui_mame32_keyc")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","KeyD")});
					document.getElementsByClassName("gui_mame32_keyx")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keyx")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","KeyQ")});
					document.getElementsByClassName("gui_mame32_keyx")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","KeyQ")});
					document.getElementsByClassName("gui_mame32_keyy")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keyy")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","KeyW")});
					document.getElementsByClassName("gui_mame32_keyy")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","KeyW")});
					document.getElementsByClassName("gui_mame32_keyz")[0].style.display = "block";
					document.getElementsByClassName("gui_mame32_keyz")[0].addEventListener("touchstart",function(event){sendVirtualKey("keydown","KeyE")});
					document.getElementsByClassName("gui_mame32_keyz")[0].addEventListener("touchend",function(event){sendVirtualKey("keyup","KeyE")});

					// SHOWING THE VIRTUAL JOYSTICK
					document.getElementsByClassName("gui_joystick")[0].style.display = "block";
					showVirtualJoystick();
					}
				});

			window.onerror = function (msg, url, lineNo, columnNo, error)
				{
				// SOMETIMES THE LIBRETRO TAKES TOO MUCH TIME TO LOAD AND MAY THROUGH AN ERROR.
				// THE CODE BELOW GIVES ANOTHER TRY TO RUN THE EMULATOR WITH THE SELECTED ROM.

				setTimeout(function()
					{
					// RUNS THE EMULATOR WITH THE SELECTED ROM
					Module.callMain(["-v","/" + parent.ROMNAME]);

					// RESIZES THE CANVAS
					document.getElementById("canvas").width = container_width;
					document.getElementById("canvas").height = container_height;
					}, 5000);
				return true;
				}
		</script>
		<div class="gui_pleasewait_title"><script>document.write(parent.STRING_STARTINGEMULATOR);</script></div><div class="pleasewait"><div class="lds-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>
		<div id="container"><canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas></div>
		<div class="gui_joystick" id="joyDiv"></div>
		<div class="gui_mame32_keycoin" oncontextmenu="return false;">COIN</div>
		<div class="gui_mame32_keystart" oncontextmenu="return false;">START</div>
		<div class="gui_mame32_keya" oncontextmenu="return false;">A</div>
		<div class="gui_mame32_keyb" oncontextmenu="return false;">B</div>
		<div class="gui_mame32_keyc" oncontextmenu="return false;">C</div>
		<div class="gui_mame32_keyx" oncontextmenu="return false;">X</div>
		<div class="gui_mame32_keyy" oncontextmenu="return false;">Y</div>
		<div class="gui_mame32_keyz" oncontextmenu="return false;">Z</div>
		<div class="gui_loading"><script>document.write(parent.STRING_LOADING);</script></div>
		<div class="gui_saving"><script>document.write(parent.STRING_SAVING);</script></div>
		<input type="file" class="fileupload_uploader" id="fileupload_uploader" onchange="upload_getFile(event.target.files);" />
		<script src="Emulatrix_MAME32.js"></script>
	</body>
</html>